/******************************************************************************/
/*!
\file   Renderer.hpp
\author David Seah Seng Chong
\par    email: sengchong.seah\@digipen.edu
\par    DigiPen login: sengchong.seah
\par    Course: GAM200
\date   21/10/2011
\brief
  Header file
  Graphics Engine

    Copyright (C) 2011 DigiPen Institute of Technology.
    Reproduction or disclosure of this file or its contents without the
    prior written consent of DigiPen Institute of Technology is prohibited.
*/
/******************************************************************************/
#ifndef RENDERER_HPP
#define RENDERER_HPP

#include <string>
#include "CVertexBuffer.hpp"

#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)

typedef std::string TEXTUREID;

typedef enum COLORS
{
    RED         = 0XFFFF0000,   // 00000001
    DARKRED     = 0XFF8B0000,   // 00000001
    GREEN       = 0XFF00FF00,   // 00000010
    BLUE        = 0XFF0000FF,   // 00000100
    DARKBLUE    = 0XFF0000FF,   // 00000100
    BLACK       = 0XFF000000,   // 00001000
    WHITE       = 0XFFFFFFFF,    // 00010000
    YELLOW      = 0XFFFFFF00,
    CYAN        = 0XFF00FFFF,
    GREY        = 0XFF41383C,
	BROWN		= 0XFF8B4513,
}Colors;

struct ForceTriList
{
    LPDIRECT3DVERTEXBUFFER9 vertexBuffer;
    unsigned long		       vNum;
};

class TextureManager;

class Renderer
{
public:
//Constructor/Destructor
Renderer(void);
~Renderer(void);

bool Initialize(HWND hWnd, int width, int height);
void InitializeResource();
void InitializeMatrices();
void PrepareToDraw();
void DrawDynamic();
void DrawAstroid( D3DXMATRIX Transformation );
void DrawBackground( D3DXMATRIX Transformation );

void DrawMenuBG( );



void DrawTexture2( D3DXMATRIX Transformation );
void DrawTexture3( D3DXMATRIX Transformation);
void DrawTexture4( D3DXMATRIX Transformation);
void DrawTexture( D3DXMATRIX Transformation);
void DrawBulletTexture( D3DXMATRIX Transformation );
void EndDraw();
void ReleaseResources();

//Accessors/Modifiers
LPDIRECT3DDEVICE9& GetDevice() { return device; }
void SetViewMatrix(const D3DXVECTOR3& eye, const D3DXVECTOR3& lookAt, const D3DXVECTOR3& up);
void SetViewMatrix(D3DXVECTOR3 vector[3]) { SetViewMatrix(vector[0], vector[1], vector[2]); }

void PrintTextWorld(std::string str, float xPos, float yPos, COLORS color = WHITE, float rectWidth = 100, float rectHeight = 100); 

private:
void SetWindowedParameters();
void SetFullScreenParameters();

    LPDIRECT3D9             context;    // What Direct3D context we're running in
    LPDIRECT3DDEVICE9       device;     // Anything that happens to Direct3D happens to this device
    D3DPRESENT_PARAMETERS   parameters; // Parameters help initialize Direct3D
    LPD3DXFONT              m_font;     // a pointer to the font interface
	CVertexBuffer m_VB;
	IDirect3DTexture9 *g_texture;
	IDirect3DTexture9 *ASteroid_texture;
	IDirect3DTexture9 *g_texture2;
	IDirect3DTexture9 *g_texture3;
	IDirect3DTexture9 *g_texture4;
	IDirect3DTexture9 *Bullet_texture;
	IDirect3DTexture9 *Back_texture;
	IDirect3DTexture9 *Menu_texture;


};

#endif